// API配置文件 - 统一管理后端接口地址
export const API_CONFIG = {
  // 后端基础URL - 根据application.properties配置
  BASE_URL: 'http://localhost:8081/api',
  
  // 图表数据相关接口
  CHART_ENDPOINTS: {
    // 城市平均薪资
    GET_CITY_AVERAGE_SALARY: '/loadChart/getCityAverageSalary',
    // 技能词云数据
    GET_SKILL_NAME_AND_OCCURRENCE_COUNT: '/loadChart/getSkillNameAndOccurrenceCount',
    // 学历和职位数量
    GET_EDUCATION_LEVEL_AND_JOB_COUNT: '/loadChart/getEducationLevelAndJobCount',
    // 学历和平均薪资
    GET_EDUCATION_LEVEL_AND_AVG_SALARY: '/loadChart/getEducationLevelAndAvgSalary',
    // 城市职位热力图数据
    GET_CITY_AND_JOB_TITLE_AND_JOB_OPENINGS: '/loadChart/getCityAndJobTitleAndJobOpenings',
    // Top10城市薪资
    GET_TOP10_CITY_SALARY: '/loadChart/getTop10CitySalary',
    // 北上广深经验数据
    GET_NORTH_SOUTH_GUANGDONG_SHENZHEN_AND_EXPERIENCE: '/loadChart/getNorthSouthGuangdongShenzhenAndExperience',
    // Top10公司
    GET_TOP10_COMPANY: '/loadChart/getTop10Company'
  },
  
  // AI聊天相关接口
  AI_ENDPOINTS: {
    CHAT: '/ai/chat',
    INTERVIEW: '/ai/interview',
    INTERVIEW_HISTORY: '/ai/interview/history',
    INTERVIEW_CREATE: '/ai/interview/create',
    INTERVIEW_DELETE: '/ai/interview/delete',
    SAVE_TALKS: '/ai/saveAiTalks',
    CLEAR_TALKS: '/ai/clearAiTalks',
    GET_HISTORY: '/ai/getChatHistory',
    GET_SESSIONS: '/ai/getChatSessions',
    GET_SESSION_MESSAGES: '/ai/getSessionMessages',
    CREATE_SESSION: '/ai/createChatSession',
    DELETE_SESSION: '/ai/deleteChatSession',
    HEALTH: '/health'
  },
  
  // 用户认证相关接口
  AUTH_ENDPOINTS: {
    LOGIN: '/login',
    REGISTER: '/register'
  },
  
  // 地区相关接口
  REGION_ENDPOINTS: {
    PROVINCES: '/region/provinces',
    CITIES: '/region/cities',
    DISTRICTS: '/region/districts',
    SEARCH: '/region/search'
  }
}

// 获取完整的API URL
export function getApiUrl(endpoint) {
  return `${API_CONFIG.BASE_URL}${endpoint}`
}

// 获取图表API URL
export function getChartApiUrl(endpointKey) {
  const endpoint = API_CONFIG.CHART_ENDPOINTS[endpointKey]
  if (!endpoint) {
    throw new Error(`Unknown chart endpoint: ${endpointKey}`)
  }
  return getApiUrl(endpoint)
}
